package com.qf.controller;

import com.qf.pojo.HouseInfo;
import com.qf.pojo.resp.BaseResult;
import com.qf.service.impl.HouseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/house")
public class HouseController {
    @Autowired
    HouseServiceImpl houseService;
    @RequestMapping("/findHouseByUid")
    public BaseResult findHouseByUid(@RequestBody Integer id){
        BaseResult result = houseService.findHouseByUid(id);
        return result;
    }
    @RequestMapping("/findAllHouse")
    public BaseResult findAllHouse(){
        BaseResult result = houseService.findAllHouse();
        return result;
    }
    @RequestMapping("/addHouse")
    public BaseResult addHouse(@RequestBody HouseInfo houseInfo, HttpSession session){
        //System.out.println(houseInfo);
        BaseResult result = houseService.addHouse(houseInfo,session);
        return result;
    }
    @RequestMapping("/updateHouse")
    public BaseResult updateHouse(@RequestBody HouseInfo houseInfo){
        BaseResult result = houseService.updateHouse(houseInfo);
        return result;
    }
    @RequestMapping("/deleteHouseByHid")
    public BaseResult deleteHouseByHid(@RequestBody Integer hid){
        BaseResult result = houseService.deleteHouseByHid(hid);
        return result;
    }

}
